﻿using WebSelfHost.Entity.Sys;
using WebSelfHost.Logic.Sys;
using WebSelfHost.Utility.Core;
using WebSelfHost.Web.Filters;

using Microsoft.AspNetCore.Mvc; 

#if NETFRAMEWORK
using System.Web.Http;
using OwinSessionMiddleware.WebApi;
#else
using Microsoft.AspNetCore.Http; 
#endif
namespace WebSelfHost.Web.Controllers.Sys
{
    [HiddenApi]
    public class UserLogOnController : BaseController
    {
        private SysUserLogOnLogic userLogOnLogic;

        public UserLogOnController()
        {
            userLogOnLogic = new SysUserLogOnLogic();
        }

         
        [HttpPost, Route("system/userLogOn/form")]
        public ActionResult Form( SysUserLogOn model)
        {
            if (model.Id.IsNullOrEmpty())
            {
                int row = userLogOnLogic.Insert(model);
                return row > 0 ? Success() : Error();
            }
            else
            {
                var row = userLogOnLogic.UpdateInfo(model);
                return row > 0 ? Success() : Error();
            }
        }

    }
}
